package com.doone.telmarket.domain;

import java.io.Serializable;

public class ServicePageView implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String serviceTypeName;
	
	private int minRowNum;
	
	private int maxRowNum;
	
	private int maxPageCount;
	
	private int pageSize = 10;
	
	private int totalCount;
	
	private int page;
	
	public ServicePageView(String serviceTypeName,int pageSize,int totalCount,int page){
		this.pageSize = pageSize;
		this.totalCount = totalCount;
		this.serviceTypeName = serviceTypeName;
		if(totalCount%pageSize!=0){
			this.maxPageCount = totalCount/pageSize+1;
		}else{
			this.maxPageCount = totalCount/pageSize;
		}
		//System.out.println("总页数:"+maxPageCount);
	}
	
	public ServicePageView(String serviceTypeName,int pageSize,int totalCount){
		this.pageSize = pageSize;
		this.totalCount = totalCount;
		this.serviceTypeName = serviceTypeName;
		if(totalCount%pageSize!=0){
			this.maxPageCount = totalCount/pageSize+1;
		}else{
			this.maxPageCount = totalCount/pageSize;
		}
	}
	

	public String getServiceTypeName() {
		return serviceTypeName;
	}

	public void setServiceTypeName(String serviceTypeName) {
		this.serviceTypeName = serviceTypeName;
	}

	public int getMinRowNum() {
		return minRowNum;
	}

	public void setMinRowNum(int minRowNum) {
		this.minRowNum = minRowNum;
	}

	public int getMaxRowNum() {
		return maxRowNum;
	}

	public void setMaxRowNum(int maxRowNum) {
		this.maxRowNum = maxRowNum;
	}

	public int getMaxCount() {
		return maxPageCount;
	}

	public void setMaxCount(int maxCount) {
		this.maxPageCount = maxCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	
	public void getNext(int page){
		if(hasNext(page)){
			minRowNum = (page-1) * pageSize;
			maxRowNum = page * pageSize;
		}else{
			minRowNum = (maxPageCount-1)*10;
			maxRowNum = totalCount;
		}
	}
	
	public void getPrivi(int page){
		if(hasPriv(page)){
			minRowNum = (page-1) * pageSize;
			maxRowNum = page * pageSize;
		}else{
			minRowNum = 0;
			maxRowNum = pageSize;
		}
		
	}
	
	public void getEndPage(){
		minRowNum = (maxPageCount-1)*10;
		maxRowNum = totalCount;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	
	public boolean hasNext(int page){
		if(page>maxPageCount){
			return false;
		}else{
			return true;
		}
	}
	
	public boolean hasPriv(int page){
		if(page<1){
			return false;
		}else{
			return true;
		}
	}

	public int getMaxPageCount() {
		return maxPageCount;
	}

	public void setMaxPageCount(int maxPageCount) {
		this.maxPageCount = maxPageCount;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}
	
	

}
